<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

class Site_map_Mod extends CI_Model {
	function __construct() {
		parent::__construct ();
	}
	
	public function create() {
		$data = array ('username' => $_POST [""], 'password' => $_POST [""], 'type_id' => $_POST [""], 'create_time' => $_POST [""] );
		$this->db->insert ( 'operat', $data );
	}
	
	public function read_all() {
		$this->db->select ( 'id, username,password,type_id,create_time' );
		$query = $this->db->get ( 'operat' );
		return $query->result ();
	
		// $query = $this->db->get_where('operat', array('id' => $id), $limit, $offset);
	}
	
	public function read_byid($id) {
		$this->db->select ( 'id, username,password,type_id,create_time' );
		$query = $this->db->get_where ( 'operat', array ('id' => $id ), $limit, $offset );
		return $query->result ();
	}
	
	public function update_byid($id) {
		$data = array ('username' => $_POST [""], 'password' => $_POST [""], 'type_id' => $_POST [""], 'create_time' => $_POST [""] );
		$this->db->where ( 'id', $id );
		$this->db->update ( 'operat', $data );
	}
	
	public function delete($id) {
		$this->db->where ( 'id', $id );
		$this->db->delete ( 'operat' );
	}

}

?>
